package org.etcsoft.examples.saniker;

public class Person {
	public String firstName = "Kim";
	public String lastName  = "Seunghan";
	public int age = 37;
	
	public Person[] children = new Person[0];
	public Person parent = null;
	
	public Person(String firstName, String lastName, int age) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.age = age;
	}
	
	public Person(String firstName, String lastName, int age, Person[] children) {
		this(firstName, lastName, age);
		this.children = children;
		for(int i = 0 ; i < children.length; i++) {
			children[i].parent = this;
		}
	}
	
	public static Person[] example() {
		return new Person[] {
				new Person("Kim"
						 , "SeungHan"
						 , 33 
						 , new Person[] { new Person("Kim", "JeaDong", 2), new Person("Kim", "Sara", 1)  }), 
				new Person("Lee"
						 , "InYoung"
						 , 33 
						 , new Person[] { new Person("Lee", "SangHea", 1), new Person("Lee", "Rion", 0)  }),
				new Person("Min"
						 , "JunHo"
						 , 33 ),
				new Person("Lee"
						 , "YoungSuck"
						 , 33 )
			};
	}
	
	public String toString() {
		return firstName + " " + lastName + " " + age;
	}
}
